/* ===============================
   Global Base Styles & Reset
   =============================== */
html, body, #root {
  height: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
  background: linear-gradient(135deg, #f5f7fa 0%, #f8fafc 100%);
  color: #1d2129;
  line-height: 1.6;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===============================
   Header Styles
   =============================== */
.app-header {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
  border-bottom: none !important;
  box-shadow: 0 4px 20px rgba(102, 126, 234, 0.15);
  position: relative;
  overflow: hidden;
}

.app-header::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(45deg, rgba(255, 255, 255, 0.1) 0%, transparent 100%);
  pointer-events: none;
}

.app-header-title {
  font-size: 20px;
  font-weight: 700;
  color: #ffffff !important;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  letter-spacing: 0.5px;
  position: relative;
  z-index: 1;
}

/* ===============================
   Layout Container Styles
   =============================== */
.page-container {
  max-width: 1200px;
  margin: 0 auto;
  min-height: 0;
  padding: 0 20px;
}

/* ===============================
   Optimized Sidebar Styles
   =============================== */
.sider-section {
  padding: 20px 16px;
  border-bottom: 1px solid #f0f2f5;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0.9), rgba(248, 250, 252, 0.9));
  transition: all 0.3s ease;
}

.sider-section:hover {
  background: linear-gradient(to bottom, rgba(255, 255, 255, 1), rgba(248, 250, 252, 1));
}

.sider-card {
  margin: 12px 8px;
  border-radius: 12px !important;
  border: 1px solid rgba(24, 144, 255, 0.08);
  background: linear-gradient(145deg, #ffffff, #fafbfc);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.sider-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, #1890ff, #52c41a, #13c2c2);
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

.sider-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(24, 144, 255, 0.15);
  border-color: rgba(24, 144, 255, 0.2);
}

.sider-card:hover::before {
  transform: scaleX(1);
}

/* 优化的侧边栏样式 */
.optimized-sidebar {
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.sidebar-toolbar-compact {
  backdrop-filter: blur(8px);
  transition: all 0.2s ease;
}

.sidebar-toolbar-compact:hover {
  background: rgba(255, 255, 255, 0.95) !important;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

/* 紧凑按钮组样式 */
.compact-button-group {
  transition: all 0.2s ease;
}

.compact-button-group:hover {
  background: rgba(24, 144, 255, 0.1) !important;
  border-color: rgba(24, 144, 255, 0.2) !important;
  transform: scale(1.02);
}

.compact-button {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.compact-button:hover {
  transform: scale(1.1) !important;
  z-index: 2;
}

.compact-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transition: left 0.3s ease;
}

.compact-button:hover::before {
  left: 100%;
}

/* 树形容器样式 */
.tree-container {
  backdrop-filter: blur(4px);
  transition: all 0.3s ease;
}

.tree-container:hover {
  background: rgba(255, 255, 255, 0.9) !important;
  border-color: rgba(24, 144, 255, 0.15) !important;
  box-shadow: 0 2px 12px rgba(24, 144, 255, 0.08);
}

/* 空状态容器 */
.empty-state-container {
  backdrop-filter: blur(4px);
  transition: all 0.3s ease;
}

.empty-state-container:hover {
  background: rgba(255, 255, 255, 0.7) !important;
  border-color: rgba(217, 217, 217, 0.7) !important;
  transform: translateY(-1px);
}

.empty-state-icon {
  transition: all 0.3s ease;
}

.empty-state-container:hover .empty-state-icon {
  transform: scale(1.05);
}

/* 加载状态容器 */
.loading-state-container {
  backdrop-filter: blur(4px);
  transition: all 0.3s ease;
}

.loading-state-container:hover {
  background: rgba(255, 255, 255, 0.7) !important;
  border-color: rgba(24, 144, 255, 0.3) !important;
}

/* 整合侧边栏工具栏样式 */
.sidebar-toolbar-button {
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.sidebar-toolbar-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.sidebar-toolbar-button::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s ease;
}

.sidebar-toolbar-button:hover::before {
  left: 100%;
}

/* 搜索输入框样式 */
.sidebar-search-input {
  transition: all 0.2s ease;
}

.sidebar-search-input:hover {
  border-color: rgba(24, 144, 255, 0.3) !important;
  box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.1) !important;
}

.sidebar-search-input:focus-within {
  border-color: #1890ff !important;
  box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.2) !important;
  background: rgba(255, 255, 255, 1) !important;
}

.sidebar-search-input .ant-input {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

.sidebar-search-input .ant-input:focus {
  background: transparent !important;
  border: none !important;
  box-shadow: none !important;
}

/* 搜索结果为空的样式 */
.search-empty-result {
  transition: all 0.3s ease;
}

.search-empty-result:hover {
  background: rgba(255, 255, 255, 0.3) !important;
}

/* 过滤标签样式 */
.filter-tags .ant-tag {
  background: rgba(24, 144, 255, 0.08);
  border: 1px solid rgba(24, 144, 255, 0.2);
  color: #1890ff;
  transition: all 0.2s ease;
}

.filter-tags .ant-tag:hover {
  background: rgba(24, 144, 255, 0.12);
  border-color: rgba(24, 144, 255, 0.3);
  transform: scale(1.05);
}

/* ===============================
   Button Enhancements
   =============================== */
.ant-btn {
  font-weight: 500;
  border-radius: 8px !important;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  border: 1px solid transparent;
}

.ant-btn-primary {
  background: linear-gradient(135deg, #1890ff 0%, #40a9ff 100%);
  border: none;
  position: relative;
  overflow: hidden;
}

.ant-btn-primary::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.5s;
}

.ant-btn-primary:hover::before {
  left: 100%;
}

.ant-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* ===============================
   Card Enhancements
   =============================== */
.ant-card {
  border-radius: 16px !important;
  border: 1px solid rgba(240, 242, 245, 0.8);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  background: linear-gradient(145deg, #ffffff, #fafbfc);
  position: relative;
  overflow: hidden;
}

.ant-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #1890ff, #52c41a, #faad14, #ff4d4f, #13c2c2);
  opacity: 0;
  transition: opacity 0.3s ease;
}

.ant-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 30px rgba(24, 144, 255, 0.12);
  border-color: rgba(24, 144, 255, 0.3);
}

.ant-card:hover::before {
  opacity: 1;
}

.ant-card-head {
  border-bottom: 1px solid rgba(240, 242, 245, 0.8);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.9), rgba(248, 250, 252, 0.9));
}

.ant-card-head-title {
  font-weight: 600;
  color: #1d2129;
}

/* ===============================
   Tree Component Enhancements
   =============================== */
.ant-tree {
  background: transparent;
}

.ant-tree-node-content-wrapper {
  border-radius: 8px;
  transition: all 0.2s ease;
  padding: 4px 8px;
}

.ant-tree-node-content-wrapper:hover {
  background: linear-gradient(90deg, rgba(24, 144, 255, 0.05), rgba(24, 144, 255, 0.1));
  transform: translateX(2px);
}

.ant-tree-node-selected .ant-tree-node-content-wrapper {
  background: linear-gradient(90deg, rgba(24, 144, 255, 0.1), rgba(24, 144, 255, 0.15)) !important;
  border: 1px solid rgba(24, 144, 255, 0.3);
  box-shadow: 0 2px 8px rgba(24, 144, 255, 0.15);
}

/* ===============================
   Input and Form Enhancements
   =============================== */
.ant-input, .ant-input-affix-wrapper {
  border-radius: 8px !important;
  border: 2px solid #e8eaed;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.02);
}

.ant-input:hover, .ant-input-affix-wrapper:hover {
  border-color: #40a9ff;
  box-shadow: 0 4px 12px rgba(64, 169, 255, 0.15);
}

.ant-input:focus, .ant-input-affix-wrapper:focus-within {
  border-color: #1890ff;
  box-shadow: 0 0 0 3px rgba(24, 144, 255, 0.1);
}

/* ===============================
   Switch Enhancements
   =============================== */
.ant-switch {
  background: linear-gradient(135deg, #bfbfbf, #8c8c8c);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.ant-switch-checked {
  background: linear-gradient(135deg, #1890ff, #40a9ff) !important;
  box-shadow: 0 2px 8px rgba(24, 144, 255, 0.3);
}

/* ===============================
   Loading and Animation States
   =============================== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.page-container > * {
  animation: fadeInUp 0.5s ease-out;
}

.ant-layout-sider {
  animation: slideInRight 0.4s ease-out;
}

/* ===============================
   Scrollbar Styling
   =============================== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: #f5f7fa;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb {
  background: linear-gradient(135deg, #c9cdd4, #a0a8b0);
  border-radius: 4px;
  border: 2px solid #f5f7fa;
}

::-webkit-scrollbar-thumb:hover {
  background: linear-gradient(135deg, #86909c, #6b7280);
}

/* ===============================
   Responsive Design
   =============================== */
@media (max-width: 768px) {
  .page-container {
    padding: 0 12px;
  }

  .sider-section {
    padding: 16px 12px;
  }

  .app-header-title {
    font-size: 18px;
  }
}

/* ===============================
   Accessibility Enhancements
   =============================== */
.ant-btn:focus-visible,
.ant-input:focus-visible,
.ant-tree-node-content-wrapper:focus-visible {
  outline: 2px solid #1890ff;
  outline-offset: 2px;
}

/* ===============================
   Additional Animations
   =============================== */
@keyframes shimmer {
  0% {
    background-position: -200px 0;
  }
  100% {
    background-position: calc(200px + 100%) 0;
  }
}

@keyframes pulse {
  0%, 100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.05);
    opacity: 0.8;
  }
}

@keyframes bounceIn {
  0% {
    transform: scale(0.3);
    opacity: 0;
  }
  50% {
    transform: scale(1.05);
  }
  70% {
    transform: scale(0.9);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

/* Badge animations */
.ant-badge {
  animation: bounceIn 0.6s ease-out;
}

/* Modal animations */
.ant-modal {
  animation: fadeInUp 0.3s ease-out;
}

.ant-modal-content {
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.15) !important;
}

/* List item hover effects */
.ant-list-item {
  transition: all 0.2s ease;
}

.ant-list-item:hover {
  transform: translateX(2px);
  box-shadow: 0 2px 8px rgba(24, 144, 255, 0.1);
}

/* Tag animations */
.ant-tag {
  transition: all 0.2s ease;
}

.ant-tag:hover {
  transform: scale(1.05);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1);
}

/* Loading shimmer effect */
.ant-spin-container {
  position: relative;
  overflow: hidden;
}

.ant-spin-blur {
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.4),
    transparent
  );
  background-size: 200px 100%;
  animation: shimmer 1.5s infinite;
}

/* ===============================
   Notification Enhancements
   =============================== */
.ant-message {
  z-index: 9999;
}

.ant-message-notice {
  border-radius: 12px !important;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.15) !important;
  animation: slideInDown 0.3s ease-out;
}

@keyframes slideInDown {
  from {
    transform: translateY(-30px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

/* ===============================
   Description List Enhancements
   =============================== */
.ant-descriptions-item-label {
  font-weight: 600 !important;
  color: #4e5969 !important;
}

.ant-descriptions-item-content {
  color: #1d2129 !important;
}

.ant-descriptions-bordered .ant-descriptions-item {
  transition: background-color 0.2s ease;
}

.ant-descriptions-bordered .ant-descriptions-item:hover {
  background-color: rgba(24, 144, 255, 0.02) !important;
}

/* ===============================
   Focus States
   =============================== */
.ant-input:focus,
.ant-input-focused {
  box-shadow: 0 0 0 3px rgba(24, 144, 255, 0.1) !important;
  border-color: #1890ff !important;
  animation: pulse 0.3s ease-out;
}

/* ===============================
   Breadcrumb Enhancements
   =============================== */
.ant-breadcrumb a {
  color: rgba(255, 255, 255, 0.85) !important;
  transition: color 0.2s ease;
}

.ant-breadcrumb a:hover {
  color: rgba(255, 255, 255, 1) !important;
}

.ant-breadcrumb .ant-breadcrumb-separator {
  color: rgba(255, 255, 255, 0.65) !important;
}

.ant-breadcrumb .ant-breadcrumb-link {
  color: rgba(255, 255, 255, 0.85) !important;
}

/* ===============================
   Drawer Enhancements
   =============================== */
.ant-drawer-mask {
  backdrop-filter: blur(4px);
  background: rgba(0, 0, 0, 0.45);
}

.ant-drawer-content {
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.12) !important;
}

.ant-drawer-header {
  border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
}

.ant-drawer-header .ant-drawer-title {
  color: #ffffff !important;
  font-weight: 600;
}

.ant-drawer-close {
  color: rgba(255, 255, 255, 0.85) !important;
}

.ant-drawer-close:hover {
  color: #ffffff !important;
}

/* ===============================
   Grid System Enhancements
   =============================== */
@media (max-width: 576px) {
  .page-container {
    padding: 0 8px !important;
  }

  .app-header-title {
    font-size: 16px !important;
  }

  .ant-layout-header {
    padding: 0 12px !important;
  }
}

@media (max-width: 768px) {
  .ant-layout-sider {
    position: fixed !important;
    height: 100vh !important;
    z-index: 1000 !important;
  }
}

/* ===============================
   Enhanced Hover Effects
   =============================== */
.ant-row {
  transition: all 0.3s ease;
}

.ant-col > .ant-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(24, 144, 255, 0.12);
}

/* ===============================
   Progress and Loading States
   =============================== */
.ant-spin-dot {
  animation: pulse 1.5s infinite ease-in-out;
}

.ant-spin-dot-item {
  background: linear-gradient(45deg, #1890ff, #40a9ff) !important;
}

/* ===============================
   Custom Animations
   =============================== */
@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideInLeft {
  from {
    opacity: 0;
    transform: translateX(-30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* ===============================
   Component Animations
   =============================== */
.ant-card {
  animation: slideInLeft 0.4s ease-out;
}

.ant-drawer .ant-card {
  animation: scaleIn 0.3s ease-out;
}

.page-container > div {
  animation: fadeInUp 0.5s ease-out;
}

/* ===============================
   Enhanced Mobile Support
   =============================== */
@media (max-width: 480px) {
  .app-header {
    padding: 0 8px !important;
  }

  .app-header-title {
    font-size: 14px !important;
  }

  .ant-layout-content {
    padding: 8px !important;
  }

  .ant-card {
    border-radius: 12px !important;
    margin-bottom: 12px;
  }

  .ant-btn {
    border-radius: 6px !important;
  }

  .sider-section {
    padding: 12px !important;
  }
}

/* ===============================
   Performance Optimizations
   =============================== */
.ant-layout,
.ant-layout-content,
.ant-layout-sider {
  will-change: transform;
}

.ant-card,
.ant-btn {
  will-change: transform, box-shadow;
}

/* ===============================
   Accessibility Improvements
   =============================== */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .ant-card {
    border: 2px solid #000 !important;
  }

  .ant-btn-primary {
    background: #000 !important;
    border-color: #000 !important;
  }
}

/* ===============================
   Dark Mode Support (Future)
   =============================== */
@media (prefers-color-scheme: dark) {
  /* Dark mode styles can be added here */
}